# -*- coding: utf-8 -*-
'''
Created on 2010-7-4

@author: me
'''
class Person:
    def __new__(self):           
        print 'call new method...'
    def __init__(self):
        print 'call init method...'
    def sayHi(self):
        print 'Hello, how are you?'
        
    @staticmethod
    def staticMehtod():
        print 'static method called'

p = Person()   #__init__方法被调用
p.sayHi()

Person.staticMehtod() #类方法，应通过类型调用。
p.staticMehtod()   #类方法，也可以通过对象名调用

# This short example can also be written as Person().sayHi() 
print '--------------------------------------'

class child (Person):
    def canntWalk(self):
        print 'yes, con\'nt walk'
    
c = child()
c.canntWalk()
